home *** CD-ROM | disk | FTP | other *** search
/ The Disc - MacWorld 1995 / PowerComputing (The Disc)(MacWorld 1995).ISO / pc / cdfactor / hcfactor / hcode.exe / hcode.DXR / 00056_parent -change graphic-.ls < prev    next >
Encoding:
Text File  |  1995-07-14  |  10.3 KB  |  234 lines

  1. property selectedCastList, theFilePath, theIFTXT
  2.  
  3. on birth me
  4.   global gmasterfolderpath, gDelimiter, gFileName
  5.   set theFilePath to gmasterfolderpath & "GRAPHIC" & gDelimiter
  6.   set theIFTXTPath to gmasterfolderpath & getProp(gFileName, #IFTXT)
  7.   fileIOread(theIFTXTPath)
  8.   set theIFTXT to the result
  9.   if not (item 2 of line 1 of theIFTXT = "2") then
  10.     alert("please use NEW IFbuilder")
  11.     quit()
  12.   end if
  13.   return me
  14. end
  15.  
  16. on importGraphic me, external
  17.   global gSoundLevel, pushBtn, pushBtn, gPictTransition, gchaptertextheight, glessonnumber, gChapterBtnLocList, gVolumeBtnLocList, gColor, gFieldTop, onIBM, gIntroPictRect, gIntroMovieRect, gSpliteSetList, gDoorLoc, gDoorOpen, gIntroText2, gtextfont, grectlist
  18.   if external = 0 then
  19.     set the colorDepth to integer(item 1 of line 2 of theIFTXT)
  20.   else
  21.     set the colorDepth to external
  22.   end if
  23.   importCast(me, "BACKGND.PCT")
  24.   importCast(me, "PLAY_UP.PCT")
  25.   importCast(me, "PLAY_DN.PCT")
  26.   importCast(me, "PAUSE_UP.PCT")
  27.   importCast(me, "PAUSE_DN.PCT")
  28.   importCast(me, "LEFT_UP.PCT")
  29.   importCast(me, "LEFT_DN.PCT")
  30.   importCast(me, "RIGHT_UP.PCT")
  31.   importCast(me, "RIGHT_DN.PCT")
  32.   importCast(me, "SLIDER.PCT")
  33.   importCast(me, "VOLUME.PCT")
  34.   importCast(me, "INDEX_UP.PCT")
  35.   importCast(me, "INDEX_DN.PCT")
  36.   importCast(me, "MENU_UP.PCT")
  37.   importCast(me, "MENU_DN.PCT")
  38.   importCast(me, "QUIT_UP.PCT")
  39.   importCast(me, "QUIT_DN.PCT")
  40.   importCast(me, "HELP_UP.PCT")
  41.   importCast(me, "HELP_DN.PCT")
  42.   importCast(me, "INDEXBKG.PCT")
  43.   importCast(me, "RETURNUP.PCT")
  44.   importCast(me, "RETURNDN.PCT")
  45.   if integer(item 3 of line 2 of theIFTXT) = 0 then
  46.     set theDoor to 0
  47.   else
  48.     set theDoor to 1
  49.     importCast(me, "DOORB_UP.PCT")
  50.     importCast(me, "DOORB_DN.PCT")
  51.     importCast(me, "DOOR.PCT")
  52.   end if
  53.   set gSoundLevel to integer(item 2 of line 2 of theIFTXT)
  54.   set the soundLevel to gSoundLevel
  55.   set the puppet of sprite 47 to 1
  56.   set the rect of sprite 47 to rect(0, 0, 640, 480)
  57.   set the foreColor of sprite 47 to integer(item 4 of line 2 of theIFTXT)
  58.   if integer(item 5 of line 2 of theIFTXT) then
  59.     set gIntroPictRect to item 3 to 6 of line 5 of theIFTXT
  60.   else
  61.     set gIntroPictRect to EMPTY
  62.   end if
  63.   if integer(item 6 of line 2 of theIFTXT) then
  64.     set gIntroMovieRect to item 3 to 6 of line 6 of theIFTXT
  65.   else
  66.     set gIntroMovieRect to EMPTY
  67.   end if
  68.   set gPictTransition to integer(item 7 of line 2 of theIFTXT)
  69.   set the textFont of cast 32 to returnFont(item 1 of line 3 of theIFTXT)
  70.   set the textSize of cast 32 to integer(item 2 of line 3 of theIFTXT)
  71.   set the textHeight of cast 32 to integer(item 3 of line 3 of theIFTXT)
  72.   set gchaptertextheight to integer(item 3 of line 3 of theIFTXT)
  73.   set the textStyle of cast 32 to item 4 of line 3 of theIFTXT
  74.   set the textFont of cast 33 to returnFont(item 1 of line 4 of theIFTXT)
  75.   set the textSize of cast 33 to integer(item 2 of line 4 of theIFTXT)
  76.   set the textHeight of cast 33 to integer(item 3 of line 4 of theIFTXT)
  77.   set the textStyle of cast 33 to item 4 of line 4 of theIFTXT
  78.   set gColor to []
  79.   setSpriteRect(me, 7)
  80.   set theRect to BoxToRect(item 3 to 6 of line 8 of theIFTXT)
  81.   set the puppet of sprite 7 to 1
  82.   set the rect of sprite 7 to theRect
  83.   set the puppet of sprite 8 to 1
  84.   set the rect of sprite 8 to theRect
  85.   set theTextRect to BoxToRect(item 3 to 6 of line 10 of theIFTXT)
  86.   setAt(theTextRect, 4, getAt(theTextRect, 2) + (gchaptertextheight * glessonnumber) + (gchaptertextheight / 2))
  87.   set the puppet of sprite 9 to 1
  88.   set the rect of cast 32 to theTextRect
  89.   set the rect of sprite 9 to theTextRect
  90.   if (getAt(theTextRect, 3) - getAt(theTextRect, 1)) > (getAt(theRect, 3) - getAt(theRect, 1)) then
  91.     setAt(theTextRect, 4, getAt(theTextRect, 2) + (gchaptertextheight * glessonnumber))
  92.     set the puppet of sprite 6 to 1
  93.     set the rect of sprite 6 to theTextRect
  94.     set gFieldTop to getAt(theTextRect, 2) - gchaptertextheight
  95.   else
  96.     setAt(theRect, 4, getAt(theRect, 2) + (gchaptertextheight * glessonnumber))
  97.     set the puppet of sprite 6 to 1
  98.     set the rect of sprite 6 to theRect
  99.     set gFieldTop to getAt(theRect, 2) - gchaptertextheight
  100.   end if
  101.   setSpriteRect(me, 11)
  102.   setSpriteRect(me, 12)
  103.   setSpriteRect(me, 13)
  104.   setSpriteRect(me, 14)
  105.   setSpriteRect(me, 15)
  106.   set theRect to BoxToRect(item 3 to 6 of line 16 of theIFTXT)
  107.   set the puppet of sprite 15 to 1
  108.   set the rect of cast 33 to theRect
  109.   set the rect of sprite 15 to theRect
  110.   setSpriteRect(me, 17)
  111.   setSpriteRect(me, 18)
  112.   setSpriteRect(me, 19)
  113.   setSpriteRect(me, 20)
  114.   set gSpliteSetList to []
  115.   add(gSpliteSetList, [47, 48])
  116.   if theDoor then
  117.     set gDoorLoc to []
  118.     set gDoorOpen to 0
  119.     setSpriteRect(me, 21)
  120.     setSpriteRect(me, 22)
  121.     set DoorLoc to item 3 to 9 of line 33 of theIFTXT
  122.     if item 8 of DoorLoc = EMPTY then
  123.       set firstH to integer(item 1 of DoorLoc)
  124.       set firstV to integer(item 2 of DoorLoc)
  125.       set stepH to integer(item 3 of DoorLoc)
  126.       set stepV to integer(item 4 of DoorLoc)
  127.       set step to integer(item 5 of DoorLoc)
  128.       repeat with m = 0 to step
  129.         append(gDoorLoc, [firstH + (stepH * m), firstV + (stepV * m)])
  130.       end repeat
  131.     else
  132.       set firstH to integer(item 1 of DoorLoc)
  133.       set firstV to integer(item 2 of DoorLoc)
  134.       set lastH to integer(item 6 of DoorLoc)
  135.       set lastV to integer(item 7 of DoorLoc)
  136.       set step to integer(item 5 of DoorLoc)
  137.       set stepH to float(lastH - firstH) / step
  138.       set stepV to float(lastV - firstV) / step
  139.       repeat with m = 0 to step - 1
  140.         append(gDoorLoc, [integer(firstH + (stepH * m)), integer(firstV + (stepV * m))])
  141.       end repeat
  142.       append(gDoorLoc, [lastH, lastV])
  143.     end if
  144.     add(gSpliteSetList, [1, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24])
  145.   else
  146.     add(gSpliteSetList, [1, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 24])
  147.   end if
  148.   set the puppet of sprite 24 to 1
  149.   set the rect of sprite 24 to BoxToRect(item 3 to 6 of line 24 of theIFTXT)
  150.   set the puppet of sprite 26 to 1
  151.   set the rect of sprite 26 to BoxToRect(item 3 to 6 of line 25 of theIFTXT)
  152.   setSpriteRect(me, 26)
  153.   setSpriteRect(me, 27)
  154.   set bigrect to item 3 to 6 of line 28 of theIFTXT
  155.   set mediumrect to item 3 to 6 of line 29 of theIFTXT
  156.   set smallrect to item 3 to 6 of line 30 of theIFTXT
  157.   set soundrect to item 3 to 6 of line 30 of theIFTXT
  158.   set gChapterBtnLocList to BoxToRect(item 3 to 6 of line 31 of theIFTXT)
  159.   set gVolumeBtnLocList to BoxToRect(item 3 to 6 of line 32 of theIFTXT)
  160.   set the ink of sprite 8 to 32
  161.   set the blend of sprite 8 to integer(item 3 of line 34 of theIFTXT)
  162.   set the foreColor of sprite 7 to integer(item 2 of line 35 of theIFTXT)
  163.   set the foreColor of sprite 8 to integer(item 3 of line 35 of theIFTXT)
  164.   add(gColor, returnRGB(integer(item 3 of line 37 of theIFTXT)))
  165.   add(gColor, returnRGB(integer(item 5 of line 38 of theIFTXT)))
  166.   add(gColor, returnRGB(integer(item 3 of line 36 of theIFTXT)))
  167.   add(gColor, returnRGB(integer(item 2 of line 39 of theIFTXT)))
  168.   add(gColor, returnRGB(integer(item 3 of line 39 of theIFTXT)))
  169.   add(gColor, returnRGB(integer(item 4 of line 39 of theIFTXT)))
  170.   add(gColor, integer(item 5 of line 39 of theIFTXT))
  171.   add(gColor, integer(item 6 of line 39 of theIFTXT))
  172.   set the foreColor of cast 32 to getAt(gColor, 1)
  173.   set the foreColor of cast 33 to getAt(gColor, 3)
  174.   set the foreColor of cast 35 to getAt(gColor, 6)
  175.   set the foreColor of cast 34 to getAt(gColor, 4)
  176.   set the puppet of sprite 29 to 1
  177.   set the foreColor of sprite 29 to getAt(gColor, 7)
  178.   set the rect of sprite 29 to rect(492, 107, 615, 119)
  179.   set the puppet of sprite 30 to 1
  180.   set the foreColor of sprite 30 to getAt(gColor, 8)
  181.   set the rect of sprite 30 to rect(500, 108, 517, 117)
  182.   set the puppet of sprite 31 to 1
  183.   set the foreColor of sprite 31 to getAt(gColor, 8)
  184.   set the rect of sprite 31 to rect(500, 385, 517, 394)
  185.   set the puppet of sprite 37 to 1
  186.   set the rect of sprite 37 to rect(492, 107, 615, 395)
  187.   set the textFont of cast 34 to returnFont(item 7 of line 39 of theIFTXT)
  188.   set the textFont of cast 35 to returnFont(item 7 of line 39 of theIFTXT)
  189.   set the textSize of cast 34 to integer(item 8 of line 39 of theIFTXT)
  190.   set the textSize of cast 35 to integer(item 8 of line 39 of theIFTXT)
  191.   set the textHeight of cast 34 to integer(item 9 of line 39 of theIFTXT)
  192.   set the textHeight of cast 35 to integer(item 9 of line 39 of theIFTXT)
  193.   set the textStyle of cast 34 to item 10 of line 39 of theIFTXT
  194.   set the textStyle of cast 35 to item 10 of line 39 of theIFTXT
  195.   set the text of cast 37 to item 2 of line 40 of theIFTXT
  196.   set gIntroText2 to item 2 of line 41 of theIFTXT
  197.   set the foreColor of cast 37 to returnRGB(integer(item 3 of line 42 of theIFTXT))
  198.   set the textFont of cast 37 to returnFont(item 4 of line 42 of theIFTXT)
  199.   set the textSize of cast 37 to integer(item 5 of line 42 of theIFTXT)
  200.   set the textHeight of cast 37 to integer(item 6 of line 42 of theIFTXT)
  201.   set the textStyle of cast 37 to item 7 of line 42 of theIFTXT
  202.   set theRect to BoxToRect(item 8 to 11 of line 42 of theIFTXT)
  203.   set the rect of cast 37 to theRect
  204.   set the puppet of sprite 48 to 1
  205.   set the locH of sprite 48 to getAt(theRect, 1)
  206.   set the locV of sprite 48 to getAt(theRect, 2)
  207.   set the backColor of cast 86 to returnRGB(integer(item 2 of line 43 of theIFTXT))
  208.   set the foreColor of cast 86 to returnRGB(integer(item 3 of line 43 of theIFTXT))
  209.   set the textFont of cast 86 to returnFont(item 4 of line 43 of theIFTXT)
  210.   set gtextfont to returnFont(item 4 of line 43 of theIFTXT)
  211.   set the textSize of cast 86 to integer(item 5 of line 43 of theIFTXT)
  212.   set the textHeight of cast 86 to integer(item 6 of line 43 of theIFTXT)
  213.   set the textStyle of cast 86 to item 7 of line 43 of theIFTXT
  214.   set theRect to BoxToRect(item 8 to 11 of line 43 of theIFTXT)
  215.   setAt(theRect, 3, getAt(theRect, 3) - 16)
  216.   set the rect of cast 86 to theRect
  217.   set the puppet of sprite 22 to 1
  218.   set the locH of sprite 22 to getAt(theRect, 1)
  219.   set the locV of sprite 22 to getAt(theRect, 2)
  220.   set grectlist to [bigrect, mediumrect, smallrect, soundrect]
  221. end
  222.  
  223. on setSpriteRect me, n
  224.   set spritenum to integer(item 2 of line n of theIFTXT)
  225.   set the puppet of sprite spritenum to 1
  226.   set the rect of sprite spritenum to BoxToRect(item 3 to 6 of line n of theIFTXT)
  227. end
  228.  
  229. on importCast me, thepictname
  230.   set thecastno to the number of cast thepictname
  231.   importFileInto(cast thecastno, theFilePath & thepictname)
  232.   set the regPoint of cast thecastno to point(the width of cast thecastno / 2, the height of cast thecastno / 2)
  233. end
  234.